﻿using AutoMapper;
using MediatR;
using SheepStorage.API.Application.Command.SheepHybridizationCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepHybridizationCommandHandler
{
    public class SheepHybridizationJudgeCommandHandler : IRequestHandler<SheepHybridizationJudgeCommand, Results<List<SheepRecord>>>
    {
        ISheepHybridizationService _res;
        IMapper _mapper;

        public SheepHybridizationJudgeCommandHandler(ISheepHybridizationService res, IMapper mapper)
        {
            _res = res;
            _mapper = mapper;
        }

        public async Task<Results<List<SheepRecord>>> Handle(SheepHybridizationJudgeCommand request, CancellationToken cancellationToken)
        {
            var list =await  _res.pz(request.momsheep);
            return  Results <List<SheepRecord>>.DataResult(list);
        }
    }
}
